﻿using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace EuphoricEngine3D.Components
{
    public class ClearScreen : Component
    {
        private Color _color;

        public ClearScreen(Color color)
            : base()
        {
            _color = color;
        }

        public ClearScreen(Color color, int drawOrder)
            : base()
        {
            _color = color;

            // Make sure this doesn't over draw the console!
            if (drawOrder == int.MaxValue)
                drawOrder -= 1;

            DrawOrder = drawOrder;
        }

        public void SetColor(Color color)
        {
            _color = color;
        }

        public override void Draw()
        {
            Parent.Engine.GraphicsDevice.Clear(_color);
        }
    }
}
